<template>
  <div class="list">
    <label for>{{item.label}}：</label>
    <el-radio v-model="radio" label="-1">{{item.radioText1}}</el-radio>
    <el-radio v-model="radio" label="1">{{item.radioText2}}</el-radio>
    <div v-show="radio == 1">
      <label class="pl" for>{{item.timesText}}：</label>
      <el-input v-model="times" class="width"></el-input>
    </div>
  </div>
</template>

<script>
export default {
  name: "serveRadio",
  props: ['item', 'serverTimes', 'isEdit'],
  data() {
    return {
      radio: '',
      times: ''
    }
  },
  methods: {
    getData() {
        let times = this.radio == 1 ? this.times : this.radio
        return Number(times)
    }
  },
  watch: {
    isEdit(val) {
      if (!val) return
      this.radio = this.serverTimes == '-1' ? String(this.serverTimes) : '1'
      this.times = this.serverTimes == '-1' ? '' : this.serverTimes
    }
  }
};
</script>

<style lang="less" scoped>
@import url('../assets/less/input.less');
.contianer {
  padding-left: 10px;
  text-align: left;
}
.title {
  border-bottom: 1px solid #eee;
  margin-bottom: 20px;
  padding-bottom: 5px;
}
.pl {
  padding-left: 36px;
}
.btn-submit{
  margin-top: 40px;
}
.width.el-input{
  width: 70px;
}
</style>
